package com.foreknow.service.impl;

import com.foreknow.dao.DepartmentMapper;
import com.foreknow.entity.Department;
import com.foreknow.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;


    @Override
    public List<Department> queryDept(String query) {
        return departmentMapper.findDept(query);
    }

    @Override
    public List<Department> heightQueryDept(Department department) {
        return departmentMapper.heightFindDept(department);
    }

    @Override
    public boolean removeDeptById(Integer id) {
        return departmentMapper.deleteDeptById(id)==1;
    }

    @Override
    public int removeDeptsById(List<Integer> ids) {
        return departmentMapper.deleteDeptsById(ids);
    }

    @Override
    public boolean addDept(Department department) {
        return departmentMapper.insertDept(department)==1;
    }

    @Override
    public boolean modifyDept(Department department) {
        return departmentMapper.updateDept(department)==1;
    }

    @Override
    public Department queryDeptById(Integer id) {
        return departmentMapper.findDeptById(id);
    }
}
